local Tool={}
Tool.delget=function (func, this, obj)
	local slot  = {}
	slot.func   = func
	slot.this  = this
	slot.obj    = obj
	slot.class  = "functor"
	setmetatable(slot, slot)    

	slot.__call = function(self, ...)
		local flag  = true  
		local msg = nil 

		if nil == self.obj then
			self.func(slot.this,...)                        
		else        
			self.func(slot.this,self.obj,...)
		end
	end

	slot.invoke = function(...)
		local flag  = true  
		local msg = nil 

		if nil == slot.obj then
			if slot.func == nil then
				print(slot.this);
			end
			slot.func(slot.this,...)                        
		else        
			if slot.func == nil then
				print(slot.this);
			end
			slot.func(slot.this,slot.obj,...)
		end
	end

	return slot
end
Tool.removeElementByKey=function (tbl,key)
	--新建一个临时的table
	local tmp ={}

	--把每个key做一个下标，保存到临时的table中，转换成{1=a,2=c,3=b} 
	--组成一个有顺序的table，才能在while循环准备时使用#table
	for i in pairs(tbl) do
		table.insert(tmp,i)
	end

	local newTbl = {}
	--使用while循环剔除不需要的元素
	local i = 1
	while i <= #tmp do
		local val = tmp [i]
		if val == key then
			--如果是需要剔除则remove 
			table.remove(tmp,i)
		else
			--如果不是剔除，放入新的tabl中
			newTbl[val] = tbl[val]
			i = i + 1
		end
	end
	return newTbl
end
Tool.TableLenght=function (t)
	local count=0
	for k,v in pairs(t) do
		if v then
			count=count+1
		end
	end
	return count
end


return Tool